1. Field of the Invention
This invention is related to the field of interface controllers and, more particularly, to updating flow control credits for transmissions on an interface.
2. Description of the Related Art
Various interfaces are used to communicate among components of an electronic system. For example, components integrated on the same semiconductor substrate (e.g. a system on a chip configuration) use intrachip interfaces to communicate. Similarly, separate circuit components (e.g. separate chips) communicate using interfaces that are physically realized on a circuit board to which those components are connected.
In many cases, the interfaces need to be flow controlled. Generally, flow control is needed whenever a receiver of a transaction on the interface may sometimes not be capable of receiving the transaction. For example, if the receiver has a queue to store transactions until they can be processed, the queue may fill and new transactions cannot be received until queue space is available. As used herein, a transaction may refer to any communication from a transmitter to a receiver on an interface. For example, if the interface is a bus, the transaction may be a transmission on the bus. If the interface is packet-based, a transaction may be a packet. In general, an interface may include any predefined communication medium and the protocol for communicating on the medium (e.g. transaction definitions).
Accordingly, flow control refers to any mechanism that may be used to control the flow of transactions on the interconnect. One common method of flow control is typically referred to as “retry”. In retry mechanisms, a transmitter attempts to transmit a transaction on the interconnect and, if the receiver cannot handle the transaction currently, the receiver signals a retry to the transmitter. The transmitter cancels the transaction internally, and may reattempt the transaction later. On a bus-based interface, the retry may be signalled via a signal on the interface. On a packet-based interface, the retry may be signalled by a negative acknowledgement packet (and positive acknowledgement packets may be used if no retry is desired).
Retry mechanisms waste bandwidth on the interface, since transactions that are attempted and retried use bandwidth that could otherwise be used to transmit transactions that are not retried. Another flow control mechanism that avoids retry is a credit-based flow control mechanism. In a credit-based system, the receiver advertises the number of credits it has allocated to a given transaction type. The credits may generally be a measure of the number of transactions that the receiver can accept before processing a received transaction to an implementation-dependent point at which the credit is freed. A transmitter records the number of credits, and consumes credits as transactions are transmitted to the receiver. If the transmitter reduces the credit count to zero, the transmitter inhibits transmitting additional transactions to the receiver until credits are freed. Thus, bandwidth is not wasted on transactions that would be retried because of flow control reasons.
For example, in the Peripheral Component Interconnect Express (PCIe) interface, a credit based system is used. Credits are indicated as freed by transmitting flow control update packets from the receiver to the transmitter. PCIe defines two required mechanisms for generating flow control packets. First, if the free credits at the transmitter for a given transaction type (as defined in the PCIe specification) are less than the number required to transmit a maximum payload sized packet and the receiver has at least one freed credit, the receiver generates a flow control update packet. Second, a timer is established (e.g. between 30 microseconds and 120 microseconds, dependent on a power savings mode of the system), and the receiver generates a flow control update packet each time the timer expires. The first mechanism may not sustain the streaming of transactions when the credits are consumed, which reduces throughput. In order to prevent starvation of credits, large buffers are required in PCIe devices. The second mechanism does not generate flow control updates frequently enough to prevent credits from being starved, either, in at least some cases. A third mechanism that is recommended, but not required, is to generate flow control update packets at the expiration of a timer that has a time interval equal to the sum of the internal delay and a fraction whose numerator is the sum of the maximum payload size and the packet overhead, multiplied by an update factor, and whose denominator is the link width. This third mechanism again requires a large buffer to support streaming transactions, since it is a fixed interval used to deal with a dynamic flow of transactions of different sizes.